# reg = /(([^\/[:space:]]*)(\/([^[:space:]]*))?([[:space:]]*\[[a-zA-Z][a-zA-Z]\])?[[:space:]]*(\((.*;?[[:space:]]?)*\))?)/
# reg = /Mozilla/

#     xxxxxx/_5.0_________________________________________[en]? ____________________________(......)         
reg = /^([^\/[:space:]]*)(\/([^[:space:]]*))?([[:space:]]*\[[a-zA-Z][a-zA-Z]\])?[[:space:]]*\((.*)\)/
teststr = 'Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; SPH-M910 Build/ECLAIR) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17'

puts teststr

if(teststr.match reg)
  puts "1start!!"
  puts $1+$2
else
  puts "fuck"
end

test2 = "Android-GData-Contacts/1.2 (SPH-M910 ECLAIR); gzip"

if(test2.match reg)
  puts "2start!!"
  puts "3:" + $3
else
  puts "2fuck"
end

test3 = "Android/2.1-update1; Samsung SPH-M910; 1.1.1"

if(test3.match reg)
  puts "3start!!"
else
  puts "3fuck"
end

test4 = "CORE/6.506.4.1 OpenCORE/2.02 (Linux;Android 2.1-update1)"

if(test4.match reg)
  puts "4start!!"
else
  puts "4fuck"
end

reg2 = /^(.*)\(.*\)/
test5 = "CORE/6.506.4.1 OpenCORE/2.02 (Linux;Android 2.1-update1)"
if (test5.match reg2)
  puts $1
else
  puts "fuck5"
end
